package com.chzn;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;


//@Component
public class MySmartInitializingSingleton implements SmartInitializingSingleton, ApplicationContextAware {

	private ApplicationContext applicationContext;

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.applicationContext = applicationContext;
	}

	/**
	 * TODO 初始化完成后 进行的回调 前提条件是:Object singletonInstance = getSingleton(beanName); 从单例池中能获取到
	 * @see DefaultListableBeanFactory#preInstantiateSingletons()
	 */
	@Override
	public void afterSingletonsInstantiated() {

	}
}
